{	Problem: http://codechef.com/problems/FCTRL/
 	Verdict: Accepted
}
var i,n:longint; k,r:int64;
begin
read(N);
for i:=1 to n do begin
  read(k);
  r:=0;
  while k>=5 do begin
    k:=k div 5;
    inc(r,k);
  end;
  writeln(r);
end;
end.